/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bsc.ejb.metadata;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

/**
 *
 * @author memozac
 */
@Entity
public class Icon implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idIcon;

    @ManyToMany(targetEntity=Colorimetry.class)
    @JoinTable(name="ColorimetryIcon",
    joinColumns=@JoinColumn(name="idIcon"),
    inverseJoinColumns=@JoinColumn(name="idColorimetry"))
    private Collection<Colorimetry> Colorimetries;
    
    @Column(columnDefinition="text")
    private String iconName;
    @Column(columnDefinition="text")
    private String iconFile;



    public Collection<Colorimetry> getColorimetries() {
        return Colorimetries;
    }

    public void setColorimetries(Collection<Colorimetry> Colorimetries) {
        this.Colorimetries = Colorimetries;
    }

    public Long getIdIcon() {
        return idIcon;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idIcon != null ? idIcon.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Icon)) {
            return false;
        }
        Icon other = (Icon) object;
        if ((this.idIcon == null && other.idIcon != null) || (this.idIcon != null && !this.idIcon.equals(other.idIcon))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bsc.ejb.entity.Icon[id=" + idIcon + "]";
    }

    /**
     * @return the iconName
     */
    public String getIconName() {
        return iconName;
    }

    /**
     * @param iconName the iconName to set
     */
    public void setIconName(String iconName) {
        this.iconName = iconName;
    }

    /**
     * @return the iconFile
     */
    public String getIconFile() {
        return iconFile;
    }

    /**
     * @param iconFile the iconFile to set
     */
    public void setIconFile(String iconFile) {
        this.iconFile = iconFile;
    }

}//ends of class
